Add paintTileMapPort to support world map tile painting (Develop)#4767
Add paintTileMapPort to support world map tile painting (Develop)#4767Crystalwarrior wants to merge 4 commits intoDFHack:developfrom
Conversation
(no getTileMapPort yet)
Split up doSetTile_char() and doGetTile_char() for non-graphics mode tile grabbing
| return true; | ||
| } | ||
|
|
||
| static bool doSetTile_map_port_default(const Pen &pen, int x, int y, int32_t * df::graphic_map_portst::*texpos_field) { |
There was a problem hiding this comment.
The purpose of doSetTile_default() is to enable GuiHooks - it's the default implementation called if no hooks are defined. Since you don't appear to be worried about GuiHooks for your new functions (which is probably fine), you can likely drop the _default functions.
Also, I would opt for consistent capitalization within function names, e.g. doSetTileMapPort or doSetMapPortTile. The _default suffix is a special case for GuiHooks, to indicate we're defining "our" default implementation of a function that could be overridden.
|
which maps does this cover? |
| { "paintTileMapPort", screen_paintTileMapPort }, | ||
| { "readTileMapPort", screen_readTileMapPort }, |
| if (lua_gettop(L) >= 4 && !lua_isnil(L, 4)) | ||
| { | ||
| if (lua_type(L, 4) == LUA_TSTRING) | ||
| pen.ch = lua_tostring(L, 4)[0]; |
There was a problem hiding this comment.
what if it's a zero-length string?
There was a problem hiding this comment.
It will still be safe, since the string is null-terminated, but it will set pen.ch to 0, which may or may not be what you want.
| if (tile == 0) | ||
| tile = vp->screentexpos_interface[index]; |
There was a problem hiding this comment.
this should be checked first since it is the "default" layer
myk002
left a comment
There was a problem hiding this comment.
previous code review feedback hasn't been addressed yet
You are now able to paint world map tiles!
Closes #4703